A simple example

We show in this section a simple example of a SIMULA program and how to compile and run it.

Create a SIMULA program with a text editor, and give it a name with extension ``sim''. In this example we name it doesit.sim:

begin
    Outtext("Simula does it in C");
    Outimage;
end

You can now compile the program with the cim command:

%cim doesit
Compiling: doesit.sim
cc -w -c doesit.c 
cc -o doesit doesit.o -lcim -lm
%

The compiler will produce C code that is further processed towards machine code with a standard C compiler. All produced files have the same name as the input file, but with different extensions. The compiled and linked program can be invoked by entering:

%doesit
Simula does it in C
%